import { createRouter, createWebHistory } from 'vue-router'
//import HomeView from '../views/HomeView.vue'
import LoginView from '../views/LoginView.vue'
import MainView  from '../views/MainView.vue'
import UserList from '@/views/UserList.vue'
import AddUser from '@/views/AddUser.vue'
import AttendanceList from '@/views/AttendanceList.vue'
import DaiLeavesList from '@/views/DaiLeavesList.vue'
import LeaveList from '@/views/LeaveList.vue'
import ModifyAttendance from '@/views/ModifyAttendance.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // {
    //   path: '/',
    //   name: 'home',
    //   component: HomeView
    // },

    {
         path: '/',
         name: 'login',
         component: LoginView
      },

      {
        path: '/main',
        name: 'main',
        component: MainView,
        // ... 子路由配置 ...
        children: [
          {
            path: 'users',
            component: UserList
          },   
          {
            path: 'adduser',
            component: AddUser
          },   
          {
            path: 'attendances',
            component: AttendanceList
          }, 
          {
            path: 'daileave',
            component: DaiLeavesList
          }, 
          {
            path: 'leaves',
            component: LeaveList
          }, 
          {
            path: 'modifyAttendance',
            component: ModifyAttendance
          }, 
        ]
      },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    }
  ]
})

export default router
